



           

using System;
using System.Collections.Generic;
using System.Web;
using System.Data.Common;
using Shohdi.DataHandler;
using System.Data;




namespace DatabaseComponent
{
    
    public partial class MaxVisitsDateDB
    {
          //Write any additional methods or properties here 
          //Don't modify any genrated classes




        /// <summary>
        /// this function will get the max record in the database
        /// </summary>
        /// <returns>the max object in a list</returns>
        public List<MaxVisitsDate> getMax()
        {

            ClassDataHandler con = new ClassDataHandler(_Connection,_Provider);

            List<MaxVisitsDate> lstRet = new List<MaxVisitsDate>();

            con.OpenConnection();


            lstRet = getMax(con);



            con.CloseConnection();


            return lstRet;


        }






        /// <summary>
        /// this function will get the max record in the database
        /// </summary>
        /// <param name="con">the connction to get its max</param>
        /// <returns>the max object in a list</returns>
        public List<MaxVisitsDate> getMax(ClassDataHandler con)
        {
            
            string strQuery = " select * from MaxVisitsDate where MaxVisitsDate.MaxConcurrenceNumber in ( select   Max(MaxConcurrenceNumber) from MaxVisitsDate)  ";


            

            List<MaxVisitsDate> lstRet = new List<MaxVisitsDate>();

            

            

            DbDataReader dr = con.SelectDataReader(strQuery, CommandType.Text);


            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    MaxVisitsDate obj = new MaxVisitsDate();
                    if (dr["ID"] != DBNull.Value)
                    {
                        obj.ID = (System.Int64)dr["ID"];
                    }
                    else
                    {
                        obj.ID = -1;
                    }
                    if (dr["MaxConcurrenceNumber"] != DBNull.Value)
                    {
                        obj.MaxConcurrenceNumber = (System.Int64)dr["MaxConcurrenceNumber"];
                    }
                    else
                    {
                        obj.MaxConcurrenceNumber = -1;
                    }
                    if (dr["CurrentDate"] != DBNull.Value)
                    {
                        obj.CurrentDate = (System.DateTime)dr["CurrentDate"];
                    }
                    else
                    {
                        obj.CurrentDate = DateTime.Now;
                    }



                    lstRet.Add(obj);


                }
            }

            dr.Close();


            
                return lstRet;
           

            
        }
    
    }

}

                        